package org.dtrd.modules.pushmessage.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.pushmessage.entity.bean.PushMessageDetail;


/**
 * <p>
 * 
 * </p>
 *
 * @author xiao
 * @since 2022-08-08
 */
@Getter
@Setter
@TableName("dtrd_rl_push_message")
public class DtrdRlPushMessage {

    /**
     * 数据ID
     */
    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    /**
     * 机构编码
     */
    @TableField("org_code")
    private String orgCode;

    /**
     * 机构名称
     */
    @TableField("org_name")
    private String orgName;

    /**
     * 推送内容
     */
    @TableField("org_push_message")
    private String orgPushMessage;

    /**
     * 关联商品/服务包 id
     */
    @TableField("org_product_id")
    private Integer orgProductId;

    /**
     * 关联商品/服务包 name
     */
    @TableField("org_product_name")
    private String orgProductName;

    /**
     * 应用状态 0-未应用 1-已应用
     */
    @TableField("apply_status")
    private Boolean applyStatus;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private Date createTime;

    /**
     * 0-未删除 1-已删除
     */
    @TableField("is_del")
    @TableLogic
    private Boolean isDel;

    public DtrdRlPushMessage init() {
        createTime = new Date();
        return this;
    }

    public DtrdRlPushMessage parseFromDto(PushMessageDetail dto) {
        dataId = dto.getDataId();
        orgCode = dto.getOrgCode();
        orgName = dto.getOrgName();
        orgPushMessage = dto.getOrgPushMessage();
        orgProductId = dto.getOrgProductId();
        orgProductName = dto.getOrgProductName();
        applyStatus = dto.getApplyStatus();
        return this;
    }


}
